package com.example.sports_meet.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.sports_meet.R;
import com.example.sports_meet.entity.Option;

import java.util.List;

public class OptionAdapter extends ArrayAdapter<Option> {
    public OptionAdapter(Context context, List<Option> options) {
        super(context, 0, options);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView = LayoutInflater.from(getContext()).inflate(R.layout.list_item, parent, false);
        }

        Option option = getItem(position);

        TextView textView = convertView.findViewById(R.id.textView);
        ImageView imageView = convertView.findViewById(R.id.imageView);

        textView.setText(option.getName());
        imageView.setImageResource(R.drawable.arrow);

        return convertView;
    }
}
